<?php

use IDock\Printer\ProposalStatusPrinter;
use IDock\Visitor\EPolicyDownloadVisitor;
use IDock\Visitor\NonCar\NonCarInquiryVisitor;
use IDock\Visitor\NonCar\NonCarProductListVisitor;
use IDock\Visitor\NonCar\NonCarProductVisitor;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumCarTaxVisitor;
use IDock\Visitor\Premium\PremiumChargingPileVisitor;
use IDock\Visitor\Premium\PremiumCoverageVisitor;
use IDock\Visitor\Premium\PremiumExtInfoVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\Premium\PremiumPolicyVisitor;
use IDock\Visitor\Premium\PremiumRelationVisitor;
use IDock\Visitor\Premium\PremiumUnderwritingVisitor;
use IDock\Visitor\Premium\PremiumVehicleVisitor;
use IDock\Visitor\ProposalRecallVisitor;
use IDock\Visitor\ProposalStatusVisitor;
use IDock\Visitor\RenewalInquiryVisitor;
use IDock\Visitor\SpecialClausesVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;
use IDock\Visitor\VehicleActualValueVisitor;
use IDock\Visitor\VehicleModelVisitor;

require_once('./vendor/autoload.php');

$IDock = new \IDock\IDock\IDock();

$HBConfig = [
    'gateway' => '*************',
    'channelCode' => '*************',
    'channelPwd' => '*************',
    'secretKey' => '*************',
    'deviceType' => '*************',
    'logsDir' => './DAJIALogs',
    'timeout' => '60',
    'proxy' => '*************',
];

require_once('config.php');

$IDock->setBean('HBIC', $HBConfig);


global $testResponse;

$testResponse = '<?xml version="1.0" encoding="UTF-8"?><PACKET type="RESPONSE" version="1.0" ><HEAD><REQUEST_TYPE>BXT</REQUEST_TYPE><RESPONSE_CODE></RESPONSE_CODE><ERROR_CODE>9999</ERROR_CODE><ERROR_MESSAGE>转投保失败,请您联系管理人员，谢谢！！</ERROR_MESSAGE></HEAD></PACKET>';


$shortName = 'HBIC';


$vin = 'LZWADAGA8HF791218';
$engineNo = '8H73121140';
$licenseNo = '川A9K7R5';
$firstRegisterDate = '2017-09-20';
$vehicleModel = '宝骏牌LZW6421CJY';

$DAJIAOrderNo = 'D20230606070000002069c21a07d36a4';

$biStartData = '2023-09-26 00:00:00';
$ciStartData = '2023-09-26 00:00:00';
$biEndData = '2024-09-25 23:59:59';
$ciEndData = '2024-09-25 23:59:59';

try {
    //$engineNo = 'SVW71217DN';
//$vin = 'LSVGZ6183J2037364';
//续保查询接口
    if (0) {
        //续保查询接口
        $renewalInquiryVisitor = new RenewalInquiryVisitor();
        //车架号
        $renewalInquiryVisitor->vin = $vin;
        //发动机号
        $renewalInquiryVisitor->engineNo = $engineNo;
        //车牌号
        $renewalInquiryVisitor->licenseNo = $licenseNo;
        $renewalInquiryVisitor->argc['type'] = 1;

        $response = $IDock->renewalInquiry($shortName, $renewalInquiryVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer \IDock\Printer\RenewalInquiryPrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer->toArray());
        exit;
    }

//车辆车型查询接口
    if (0) {
        //车辆车型查询接口
        $vehicleModelVisitor = new VehicleModelVisitor();
        //车架号
        $vehicleModelVisitor->vin = $vin;
        //$vehicleModelVisitor->vin = '';
        //发动机号
        $vehicleModelVisitor->engineNo = $engineNo;
        //车牌号
        $vehicleModelVisitor->licenseNo = $licenseNo;
        //初登时间
        $vehicleModelVisitor->firstRegisterDate = $firstRegisterDate;
        //车型编码
        $vehicleModelVisitor->vehicleModel = $vehicleModel;
        //$vehicleModelVisitor->vehicleModel = '';
        $vehicleModelVisitor->argc['comCode'] = '0106';
        $vehicleModelVisitor->argc['orderNo'] = $DAJIAOrderNo;

        $response = $IDock->vehicleModel($shortName, $vehicleModelVisitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer \IDock\Printer\VehicleModelPrinter
         */
        $printer = $response->getPrinter();
        if ($printer) var_dump($printer->toArray());
        exit;
    }

//车辆实际价格
    if (0) {
        //车辆实际价格
        $vehicleActualValueVisitor = new VehicleActualValueVisitor();
        $vehicleActualValueVisitor->startDate = $biStartData;
        $vehicleActualValueVisitor->firstRegisterDate = $firstRegisterDate;
        $vehicleActualValueVisitor->firstRegisterDate = $firstRegisterDate;
        //车辆价格
        $vehicleActualValueVisitor->vehiclePrice = '126800';
        //能源类型
        $vehicleActualValueVisitor->energyType = 'E01';
        //是否新能源
        $vehicleActualValueVisitor->isNewEnergy = false;
        //使用性质
        $vehicleActualValueVisitor->useNatureCode = '01';
        //车辆用途
        $vehicleActualValueVisitor->causeType = '001';
        //车辆种类
        $vehicleActualValueVisitor->carKindCode = '100';
        //座位数
        $vehicleActualValueVisitor->vehicleSeat = '5';
        //荷载质量
        $vehicleActualValueVisitor->vehicleTonnage = '1200';

        $vehicleActualValueVisitor->argc['comCode'] = '0106';

        $response = $IDock->vehicleActualValue($shortName, $vehicleActualValueVisitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer \IDock\Printer\VehicleActualValuePrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer->toArray());
        exit;
    }

//询价前置
//保费计算
//核保
    if (1) {

        /**
         * 询价主信息
         */
        $premiumInquiryVisitor = new PremiumInquiryVisitor();
        //商业险起保日期
        $premiumInquiryVisitor->biStartData = $biStartData;
        //商业险终保日期
        $premiumInquiryVisitor->biEndData = $biEndData;
        //交强险起保日期
        $premiumInquiryVisitor->ciStartData = $ciStartData;
        //交强险终保日期
        $premiumInquiryVisitor->ciEndData = $ciEndData;
        //商业险即时生效
        $premiumInquiryVisitor->biEffectFlag = false;
        //交强险即时生效
        $premiumInquiryVisitor->ciEffectFlag = false;

        $premiumInquiryVisitor->isNewEnergy = false;

        /**
         * 车辆信息
         */
        $premiumVehicleVisitor = new PremiumVehicleVisitor();
        //是否新车
        $premiumVehicleVisitor->isNewVehicle = '0';
        //车架号
        $premiumVehicleVisitor->vin = $vin;
        //发动机号
        $premiumVehicleVisitor->engineNo = $engineNo;
        //车牌号
        $premiumVehicleVisitor->licenseNo = $licenseNo;
        //初登时间
        $premiumVehicleVisitor->firstRegisterDate = $firstRegisterDate;
        //过户时间
        $premiumVehicleVisitor->transferDate = '';
        //是否过户车
        $premiumVehicleVisitor->isTransfer = '';
        //发证时间
        $premiumVehicleVisitor->issueDate = '';
        //车型编码
        $premiumVehicleVisitor->vehicleModel = $vehicleModel;
        //车型编码代码
        $premiumVehicleVisitor->vehicleModelCode = 'DZAATD0124';
        //$premiumVehicleVisitor->vehicleModelCode = 'BTYOSPUB0014';
        //车型名称
        $premiumVehicleVisitor->vehicleName = '大众牌FV7150FCMBG';
        //车价
        $premiumVehicleVisitor->vehiclePrice = '72800.0';
        //车价含税
        $premiumVehicleVisitor->vehiclePriceTax = '79022.0';
        //协商价格
        $premiumVehicleVisitor->actualValue = '72783.2';
        //座位数
        $premiumVehicleVisitor->vehicleSeat = '5';
        //使用性质
        $premiumVehicleVisitor->useNatureCode = '01';
        //所属性质
        $premiumVehicleVisitor->attachNature = '01';
        //车辆用途
        $premiumVehicleVisitor->causeType = '001';
        //车辆种类
        $premiumVehicleVisitor->carKindCode = '100';
        //能源类型代码
        $premiumVehicleVisitor->energyTypeCode = 'E01';//燃油
        //号牌颜色代码
        $premiumVehicleVisitor->licenseColorCode = '01';
        //号牌种类代码
        $premiumVehicleVisitor->licenseTypeCode = '02';
        //交管车辆类型代码
        $premiumVehicleVisitor->vehicleStyleCode = 'K33';
        //功率
        $premiumVehicleVisitor->power = '79.0';
        //排量
        $premiumVehicleVisitor->vehicleExhaust = '1498.0';
        //整备质量
        $premiumVehicleVisitor->wholeWeight = '1090';
        //荷载质量
        $premiumVehicleVisitor->vehicleTonnage = '0.0';
        //进口标识
        $premiumVehicleVisitor->vehicleImport = 'I2';
        //是否能源车
        $premiumVehicleVisitor->isNewEnergy = '0';
        //纯电续航里程(公里)
        $premiumVehicleVisitor->pureRange = '';
        //车辆来历凭证编号
        $premiumVehicleVisitor->carCertificateNo = '';
        //开具车辆来历凭证所载日期
        $premiumVehicleVisitor->carCertificateDate = '';
        //车辆来历凭证种类代码
        $premiumVehicleVisitor->carCertificateType = '';

        /**
         * 关系人
         */
        $premiumRelationVisitor = new PremiumRelationVisitor();
        //姓名
        $premiumRelationVisitor->name = '郑文庄';
        //联系方式
        $premiumRelationVisitor->mobile = '18318327016';
        //类型
        $premiumRelationVisitor->typeCode = 'R1';
        //证件类型
        $premiumRelationVisitor->certificateTypeCode = '01';
        //证件号码
        $premiumRelationVisitor->certificateNo = '513902199412250053';
        //地址
        $premiumRelationVisitor->address = '四川省简阳市简城镇升阳村六社18号';
        //邮箱
        $premiumRelationVisitor->email = '18982272991@qq.com';
        //证件有效期
        $premiumRelationVisitor->certificateStartDate = '2000-01-01';
        //证件失效期
        $premiumRelationVisitor->certificateEndDate = '2050-01-01';

        /**
         * 缴税信息
         */
        $premiumCarTaxVisitor = new PremiumCarTaxVisitor();
        //缴税内心
        $premiumCarTaxVisitor->taxTypeCode = 'T01';
        //纳税人姓名
        $premiumCarTaxVisitor->taxpayerName = '郑文庄';
        //纳税人证件类型
        $premiumCarTaxVisitor->taxpayerCertificateTypeCode = '01';
        //纳税人证件号码
        $premiumCarTaxVisitor->taxpayerCertificateNo = '513902199412250053';
        //纳税人电话
        $premiumCarTaxVisitor->taxpayerPhone = '18318327016';
        //纳税起期
        $premiumCarTaxVisitor->taxStartDate = '';
        //纳税止期
        $premiumCarTaxVisitor->taxEndDate = '';
        //减免税方案代码
        $premiumCarTaxVisitor->taxReductionCode = '';
        //减免税原因代码
        $premiumCarTaxVisitor->taxReductionReasonCode = '';
        //税务机关名称
        $premiumCarTaxVisitor->taxDepartment = '';
        //税务机关代码
        $premiumCarTaxVisitor->taxDepartmentCode = '';
        //开具完税凭证地区代码
        $premiumCarTaxVisitor->taxPaidAreaCode = '';
        //完税凭证填发日期
        $premiumCarTaxVisitor->taxDocumentDate = '';
        //减免比例 百分比
        $premiumCarTaxVisitor->taxFreeRate = '';
        //减税金额 元
        $premiumCarTaxVisitor->taxExemption = '';
        //减免完税凭证号
        $premiumCarTaxVisitor->taxDocumentNumber = '';

        //险种

        //
        $premiumCoverageVisitor = new PremiumCoverageVisitor();
        $premiumCoverageVisitor->coverageCode = 'C04001';
        $premiumCoverageVisitor->amount = '10000';
        $premiumCoverageVisitor->quantity = '1';

        $premiumCoverageVisitor1 = new PremiumCoverageVisitor();
        $premiumCoverageVisitor1->coverageCode = 'C05001';
        $premiumCoverageVisitor1->quantity = '4';
        $premiumCoverageVisitor1->amount = '40000';
        $premiumCoverageVisitor1->unitAmount = '10000';

        //
        $premiumCoverageVisitor2 = new PremiumCoverageVisitor();
        $premiumCoverageVisitor2->coverageCode = 'C03001';
        $premiumCoverageVisitor2->amount = '1000000';

        $premiumCoverageVisitor3 = new PremiumCoverageVisitor();
        $premiumCoverageVisitor3->coverageCode = 'C01001';
        $premiumCoverageVisitor3->amount = '950';

        $premiumCoverageVisitor4 = new PremiumCoverageVisitor();
        $premiumCoverageVisitor4->coverageCode = 'C08001';
        $premiumCoverageVisitor4->serviceTimes = '2';


        //新能源充电桩信息
        $premiumChargingPileVisitor = new PremiumChargingPileVisitor();

        $premiumChargingPileVisitor->seqNo = '1';
        //充电桩类型
        $premiumChargingPileVisitor->chargingPileKind = 'PK1';
        //充电桩安装地点类型
        $premiumChargingPileVisitor->chargingPileAddressType = 'PA1';
        //充电桩使用年限
        $premiumChargingPileVisitor->chargingPileYearLimit = 'PY1';
        //充电桩编码
        $premiumChargingPileVisitor->chargingPileCode = '123456';
        //充电桩型号
        $premiumChargingPileVisitor->chargingPileType = 'BCS100500';
        //充电桩地址
        $premiumChargingPileVisitor->chargingPileAddress = '地面充电桩';
        //损失保险保额
        $premiumChargingPileVisitor->lossAmount = '10000';
        //责任保险保额
        $premiumChargingPileVisitor->liabilityAmount = '10000';

        /**
         * 拓展信息
         */
        $premiumExtInfoVisitor = new PremiumExtInfoVisitor();
        //验车情况
        $premiumExtInfoVisitor->carCheckCode = '';
        //免验原因
        $premiumExtInfoVisitor->carCheckReasonKind = '';
        //验车人
        $premiumExtInfoVisitor->carChecker = '';
        //验车日期
        $premiumExtInfoVisitor->carCheckDate = '';
        //验车地点
        $premiumExtInfoVisitor->carAddress = '';
        //是否送修
        $premiumExtInfoVisitor->isMonopoly = '';
        //送修代码
        $premiumExtInfoVisitor->repairCode = '';
        //送修名称
        $premiumExtInfoVisitor->repairName = '';
        //自主定价系数
        $premiumExtInfoVisitor->selfPricingFactor = '';
        //自主核保系数
        $premiumExtInfoVisitor->underwritingFactor = '';
        //期望折扣
        $premiumExtInfoVisitor->expectedDiscount = '';
        //是否贷款车
        $premiumExtInfoVisitor->isLoanCar = '';
        //贷款机构名称
        $premiumExtInfoVisitor->loanOrg = '';

        //恒邦拓展
        $premiumExtInfoVisitor->argc['INPUTSYSCODE'] = '0401';
        $premiumExtInfoVisitor->argc['PACKAGECODE'] = 'P01';
        $premiumExtInfoVisitor->argc['COMPANYCODE'] = '0106010101';
        $premiumExtInfoVisitor->argc['AGREEMENTNO'] = '010601010100200010';
        $premiumExtInfoVisitor->argc['INTERMEDIARYCODE'] = '075000000914';
        $premiumExtInfoVisitor->argc['SALESMANCODE'] = '3600001010';
        $premiumExtInfoVisitor->argc['BUSINESSSOURCE'] = '0100';
        $premiumExtInfoVisitor->argc['CHANNELTIP'] = '04010100';
        $premiumExtInfoVisitor->argc['CHANNELDETAILCODE'] = '0401';
        $premiumExtInfoVisitor->argc['OPERATORCODE'] = 'PSC0000008';
        $premiumExtInfoVisitor->argc['brandName'] = '广汽';
        $premiumExtInfoVisitor->argc['comCode'] = '0106';

        //添加车辆信息
        $premiumInquiryVisitor->setVehicleVisitor($premiumVehicleVisitor);
        //添加投保人
        $premiumInquiryVisitor->setApplicantVisitor($premiumRelationVisitor);
        //添加被保人
        $premiumInquiryVisitor->setInsuredVisitor($premiumRelationVisitor);
        //添加车主
        $premiumInquiryVisitor->setOwnerVisitor($premiumRelationVisitor);
        //车船税
        $premiumInquiryVisitor->setCarTaxVisitor($premiumCarTaxVisitor);
        //险种添加
        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor1);
        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor2);
        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor);
        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor3);
        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor4);
        //新能源充电桩
        $premiumInquiryVisitor->chargingPileVisitorAppend($premiumChargingPileVisitor);
        //拓展信息
        $premiumInquiryVisitor->setExtInfoVisitor($premiumExtInfoVisitor);

        //非车询价参数
        $nonCarInquiry = new NonCarInquiryVisitor();
        $nonCarInquiry->nonCarListAppend(new NonCarProductVisitor());
        $premiumInquiryVisitor->setNonCarUnderwritingVisitor($nonCarInquiry);
        $premiumInquiryVisitor->setNonCarInquiryVisitor($nonCarInquiry);

        //询价前置
        //$response = $IDock->preInquiry($shortName, $premiumInquiryVisitor);
        //var_dump($response->isSuccess());
        //var_dump($response->getError());
        /**
         * @var $printer \IDock\Printer\preInquiryPrinter;
         */
        //$printer = $response->getPrinter();
        //var_dump($printer->toArray());
        //exit;

        /*$testResponse  ='<?xml version="1.0" encoding="UTF-8"?><Packet><Head><RequestType>V00</RequestType><SerialNo>640f796e50c74e2c9ad5085ea333c0c93bbedd39</SerialNo><ResponseCode>0</ResponseCode><ErrorCode>0000</ErrorCode><ErrorMessage>成功</ErrorMessage></Head><Body><TotalPrem>1559.17</TotalPrem><TotalSumlimit>2363631.4</TotalSumlimit><CHDRiskInfo>{"cEngNo":"181954017","cpkid":"ff80808189b14daf0189ba5741450657","dptCde":"51 ","highRisk":"-1","highRiskStatus":"0","plateNo":"川AU37G4","priScore":"11.52","priTranche":"18","status":"1","tCrtTm":1691048427000,"type":"B2","vin":"LSGXC8355JV261368"}</CHDRiskInfo><TotalPremAndTax>1859.17</TotalPremAndTax><CI><CQueryNo>599510803602023046464</CQueryNo><Prem>665.0</Prem><Tax>300.0</Tax><RenewFlag>0</RenewFlag><DPrem>950.0</DPrem><Discount>0.7</Discount><DupFlag>0</DupFlag><TaxDetail><AnnualTaxDue>300.0</AnnualTaxDue><SumTaxDefault>0.0</SumTaxDefault><SumOverdue>0.0</SumOverdue></TaxDetail><SpecialContact>四川保险业消费者权益保护中心维权热线：028-841-12378。@因履行本保险合同发生的争议，除条款约定的合同争议解决方式外，还可向四川保险业消费者权益保护中心申请调解。@温馨提示：尊敬的客户，投保次日起，您可通过本网站、客服电话、营业网点核实保单及理赔等信息。若对查询结果有异议，请联系本公司。联系方式：网址：http://www.e-acic.com 电话：95544。@2023年2季度，我司综合偿付能力充足率为236.87%，符合监管要求。2023年1季度，我司风险综合评级（分类监管）为B 。 @本保单保险费为含税金额，其中不含税保险费**元、增值税**元。@本车险相关信息将由本公司共享至四川省保险行业协会，用于（且仅用于）行业与交管等政府部门进行信息共享，用于风险防范、社会管理等目的。</SpecialContact><CIExpectedLossRatio>0.5366</CIExpectedLossRatio><BIExpectedLossRatio>0.0</BIExpectedLossRatio><TExpectedLossRatio>0.5366</TExpectedLossRatio><PreUndrMsg>自核结果为：下发修改。单车核保通则库_总部：未上传影像，下发修改 ;</PreUndrMsg><NewFuelVhlFlag>0</NewFuelVhlFlag><ChangedVehlValue>113631.4</ChangedVehlValue><DRUBIType></DRUBIType><DRUBIScore></DRUBIScore><AcicVhlScore></AcicVhlScore></CI><BI><QueryPastDate></QueryPastDate><RenewFlag>0</RenewFlag><BQueryNo>599510803662023052625</BQueryNo><BPremium>894.17</BPremium><BSumlimit>2163631.4</BSumlimit><CoverageItem><CoverageCode>0101200</CoverageCode><Premium>660.98</Premium><Sumlimit>113631.4</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><CoverageItem><CoverageCode>0101600</CoverageCode><Premium>208.17</Premium><Sumlimit>2000000.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><CoverageItem><CoverageCode>0101701</CoverageCode><Premium>7.07</Premium><Sumlimit>10000.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><CoverageItem><CoverageCode>0101702</CoverageCode><Premium>17.95</Premium><Sumlimit>40000.0</Sumlimit><DeductPrem>0.0</DeductPrem></CoverageItem><Discount>0.25</Discount><BDPremium>3576.68</BDPremium><NCD>0.5</NCD><DupFlag>0</DupFlag><PlateTransferType></PlateTransferType><SpecialContact>四川保险业消费者权益保护中心维权热线：028-841-12378。@因履行本保险合同发生的争议，除条款约定的合同争议解决方式外，还可向四川保险业消费者权益保护中心申请调解。@温馨提示：尊敬的客户，投保次日起，您可通过本网站、客服电话、营业网点核实保单及理赔等信息。若对查询结果有异议，请联系本公司。联系方式：网址：http://www.e-acic.com 电话：95544。@2023年2季度，我司综合偿付能力充足率为236.87%，符合监管要求。2023年1季度，我司风险综合评级（分类监管）为B 。 @本车险相关信息将由本公司共享至四川省保险行业协会，用于（且仅用于）行业与交管等政府部门进行信息共享，用于风险防范、社会管理等目的。@本保单保险费为含税金额，其中不含税保险费**元、增值税**元。@经保险双方协商同意，本车投保人以非营业用车性质向保险人投保，若本车用于营业用途发生事故，保险人对事故造成的损失不承担赔偿责任。</SpecialContact><NCDFlag>1</NCDFlag><AutoPriceDiscount>0.5</AutoPriceDiscount><CIExpectedLossRatio>0.3646</CIExpectedLossRatio><BIExpectedLossRatio>0.857</BIExpectedLossRatio><TExpectedLossRatio>0.647</TExpectedLossRatio><ReInsureItem></ReInsureItem><VhlSimpleFreeRate>0.0</VhlSimpleFreeRate><AdviceDiscount>0.25</AdviceDiscount><PreUndrMsg>交强险提示信息：自核结果为：下发修改。单车核保通则库_总部：未上传影像，下发修改 ; 商业险提示信息：自核结果为：下发修改。单车核保通则库_总部：未上传影像，下发修改 ;</PreUndrMsg><NewFuelVhlFlag>0</NewFuelVhlFlag><ChangedVehlValue>113631.4</ChangedVehlValue><ChargingPostInfoList></ChargingPostInfoList><DRUBIType></DRUBIType><DRUBIScore></DRUBIScore><AcicVhlScore></AcicVhlScore></BI><MFileList><MFileItem><FileType>1002</FileType><FileDesc>投保人身份证</FileDesc></MFileItem><MFileItem><FileType>1003</FileType><FileDesc>被保人身份证</FileDesc></MFileItem><MFileItem><FileType>1004</FileType><FileDesc>行驶证</FileDesc></MFileItem><MFileItem><FileType>1005</FileType><FileDesc>验车照</FileDesc></MFileItem><MFileItem><FileType>1006</FileType><FileDesc>验车报告</FileDesc></MFileItem><MFileItem><FileType>1010</FileType><FileDesc>上年保单证明资料</FileDesc></MFileItem></MFileList></Body></Packet>';*/

//        //询价
//        $response = $IDock->premiumInquiry($shortName, $premiumInquiryVisitor);
//        var_dump($response->isSuccess());
//        var_dump($response->getError());
//
//        /**
//         * @var $printer \IDock\Printer\Premium\PremiumInquiryPrinter;
//         */
//        $printer = $response->getPrinter();
//        var_dump($response->getPrinter()->toArray());
//        exit;

        /**
         * 核保信息
         */
        $premiumUnderwritingVisitor = new PremiumUnderwritingVisitor();
        $premiumUnderwritingVisitor->inquiryNo = 'T060101136320230000221';
        $premiumUnderwritingVisitor->biInquiryNo = '';
        $premiumUnderwritingVisitor->ciInquiryNo = '';
        $extVisitor = $premiumInquiryVisitor->getExtInfoVisitor();
        $extVisitor->argc['isNewCar'] = 0;
        $extVisitor->argc['token'] = 'eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJIQklOQyIsInN1YiI6InBhc3N3ZDpIQlAwMDAwMDY3IiwiaWF0IjoxNjk1NzgyMTY1LCJqdGkiOiI3ODhjYWJmOS02MDViLTRlNmUtOTZlNS1iMTYwNmYzOWM5OGEiLCJBVVRIT1JJVElFU19LRVkiOiJST0xFX0FETUlOLFJPTEVfSEJfQVVUT19JTlNVUkFBTkNFLFJPTEVfSEJfTk9OX0FVVE9fSU5TVVJBQU5DRSxST0xFX1VTRVIiLCJsb2dpbkNvbXBhbnlDb2RlIjoiMDEiLCJsb2dpblVzZXJOYW1lIjoiSEJQMDAwMDA2NyIsInRva2VuU291cmNlIjoiSEIiLCJsb2dpblVzZXJUeXBlIjoiMCIsImxvZ2luQ3RsRmxhZyI6IiIsInJlc291cmNlVHlwZSI6IiIsImV4cCI6MTY5NTg2ODU2NX0.DBA4k9W3ClTyREmcmETprgSrN8AO4i3L5g7K_tW_LRMgcdtZZKRE73rhA4ASBJ13WYCBBYc8m6g2PkS69h94yg';
        $premiumInquiryVisitor->setExtInfoVisitor($extVisitor);
        $premiumInquiryVisitor->fileAppend('10010', 'https://static.flashmiao.com/excel/202339/front.jpg');

        $specialClauses = new SpecialClausesVisitor();
//        $specialClauses->clauseCode = 'T002_1';
//        $specialClauses->clauseName = '交强险投保提示';
//        $specialClauses->clauseContent = '保险人已告知投保人，本保险为商业保险，应按规定另行办理交强险。保险车辆未投保交强险或交强险合同已经失效的，对于交强险责任限额以内的损失和费用，本公司不负责赔偿。';
//        $specialClauses->clauseType = '0';
//        $specialClauses->riskType = 'TCI';
//        $specialClauses->autoFlag = '1';

//        $specialClauses2 = new SpecialClausesVisitor();
//        $specialClauses2->clauseCode = '0251';
//        $specialClauses2->clauseName = '0251';
//        $specialClauses2->clauseContent = '若本车用于营业用途发生事故，保险人对事故造成的损失不承担赔偿责任。';
//        $specialClauses2->clauseType = '0';
//        $specialClauses2->riskType = 'VCI';
//        $specialClauses2->autoFlag = '0';

        $premiumUnderwritingVisitor->specialClausesAppend($specialClauses);
//        $premiumUnderwritingVisitor->specialClausesAppend($specialClauses2);

        $premiumInquiryVisitor->setUnderwritingVisitor($premiumUnderwritingVisitor);

/*        $testResponse = '<?xml version="1.0" encoding="UTF-8"?><PACKET type="RESPONSE" version="1.0" ><HEAD><REQUEST_TYPE>258</REQUEST_TYPE><RESPONSE_CODE>1</RESPONSE_CODE><ERROR_CODE>0000</ERROR_CODE><ERROR_MESSAGE>成功</ERROR_MESSAGE><LOGID></LOGID></HEAD><BODY><BASE_PART><ENQUIRYNO>02060101000020230000980</ENQUIRYNO><PREUNDWRTRESULT>9</PREUNDWRTRESULT><PACKAGECODE></PACKAGECODE><RENEWIND>0</RENEWIND><PROPOSALNO>T060101136320230000217</PROPOSALNO><PROPOSALNOBI>T060101080820230000266</PROPOSALNOBI><PROPOSALNOCI>T060101080120230000256</PROPOSALNOCI></BASE_PART><SALESFEELIST><SALESFEE><FEETYPE>355</FEETYPE><FEEPERCENT>0.0</FEEPERCENT><RISKCODE>0801</RISKCODE><FEEAMOUNT>0.0</FEEAMOUNT></SALESFEE><SALESFEE><FEETYPE>355</FEETYPE><FEEPERCENT>0.0</FEEPERCENT><RISKCODE>0808</RISKCODE><FEEAMOUNT>0.0</FEEAMOUNT></SALESFEE><SALESFEE><FEETYPE>201</FEETYPE><FEEPERCENT>4.0</FEEPERCENT><RISKCODE>0801</RISKCODE><FEEAMOUNT>35.85</FEEAMOUNT></SALESFEE><SALESFEE><FEETYPE>201</FEETYPE><FEEPERCENT>20.0</FEEPERCENT><RISKCODE>0808</RISKCODE><FEEAMOUNT>127.99</FEEAMOUNT></SALESFEE></SALESFEELIST></BODY></PACKET>';*/

        //核保
        $response = $IDock->underwriting($shortName, $premiumInquiryVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer \IDock\Printer\PremiumUnderwritingPrinter;
         */
        $printer = $response->getPrinter();

        var_dump($printer->toArray());
        exit;
    }

//支付
    if (1) {
        $policyPaymentVisitor = new PolicyPaymentVisitor();
        $policyPaymentVisitor->inquiryNo = 'T060101136320230000217';
        $policyPaymentVisitor->biInquiryNo = '';
        $policyPaymentVisitor->ciInquiryNo = '599510803602023000184';
//        global $testResponse;
//        $testResponse = '';
        $policyPaymentVisitor->argc['totalPremium'] = 0;
        $response = $IDock->policyPayment($shortName, $policyPaymentVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());
        /**
         * @var $printer \IDock\Printer\PolicyPaymentPrinter
         */
        $printer = $response->getPrinter();

        var_dump($printer->toArray());
        exit;
    }

//影像资料上传
    if (0) {
        $uploadFileVisitor = new UploadFileVisitor();
        $uploadFileVisitor->inquiryNo = '02060101000020230001002';
        $uploadFileVisitor->biInquiryNo = '599510803662023000190';
        $uploadFileVisitor->ciInquiryNo = '599510803602023000152';
        $uploadFileVisitor->argc['isNewCar'] = 1;
        $uploadFileVisitor->argc['token'] = 'eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJIQklOQyIsInN1YiI6InBhc3N3ZDpIQlAwMDAwMDY3IiwiaWF0IjoxNjk1NzgwOTU5LCJqdGkiOiJkMTExNWRmOS0xZTUxLTRiODUtOTdiOC03ZmMxOGMwNWUwMDQiLCJBVVRIT1JJVElFU19LRVkiOiJST0xFX0FETUlOLFJPTEVfSEJfQVVUT19JTlNVUkFBTkNFLFJPTEVfSEJfTk9OX0FVVE9fSU5TVVJBQU5DRSxST0xFX1VTRVIiLCJsb2dpbkNvbXBhbnlDb2RlIjoiMDEiLCJsb2dpblVzZXJOYW1lIjoiSEJQMDAwMDA2NyIsInRva2VuU291cmNlIjoiSEIiLCJsb2dpblVzZXJUeXBlIjoiMCIsImxvZ2luQ3RsRmxhZyI6IiIsInJlc291cmNlVHlwZSI6IiIsImV4cCI6MTY5NTg2NzM1OX0.Z5CAioDqnteM3a4A1SRSZ4JQRsQ9sp61alOOTSjal1LX1sD0IP9fJhVql5HxoFWRe5OpViOvOwxO1yq1o2UIeA';

        $uploadFileVisitor->fileAppend('10010', 'https://p0.itc.cn/q_70/images03/20220512/77ed76720a1f40ef94948761dda05655.jpeg');

        $response = $IDock->uploadFile($shortName, $uploadFileVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var  $printer \IDock\Printer\UploadFilePrinter
         */
        $printer = $response->getPrinter();

        var_dump($printer->toArray());
        exit;
    }

//投保单查询
    if (1) {

//        $testResponse = '';
        $proposalStatusVisitor = new ProposalStatusVisitor();

        $proposalStatusVisitor->inquiryNo = 'T060101080820240000079';
        $proposalStatusVisitor->biInquiryNo = '';
        $proposalStatusVisitor->ciInquiryNo = '';
        $proposalStatusVisitor->argc['comCode'] = '0106';

        $response = $IDock->proposalStatus($shortName, $proposalStatusVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /*** @var $printer ProposalStatusPrinter; */
        $printer = $response->getPrinter();

        var_dump($printer);
        exit;
    }

//撤单
    if (0) {
        $proposalRecallVisitor = new ProposalRecallVisitor();

        $proposalRecallVisitor->inquiryNo = '599510803682023000036';
        $proposalRecallVisitor->biInquiryNo = '';
        $proposalRecallVisitor->ciInquiryNo = '599510803682023000036';
        $proposalRecallVisitor->reason = '客户注销';
        $proposalRecallVisitor->argc['OrgCode'] = '51080503';

        $response = $IDock->proposalRecall($shortName, $proposalRecallVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer \IDock\Printer\ProposalRecallPrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer->toArray());
        exit;
    }

//核保撤单
    if (0) {
        $underwritingRecallVisitor = new UnderwritingRecallVisitor();

        $underwritingRecallVisitor->inquiryNo = '599510803682023000036';
        $underwritingRecallVisitor->biInquiryNo = '';
        $underwritingRecallVisitor->ciInquiryNo = '599510803682023000036';
        $underwritingRecallVisitor->reason = '投保注销';
        $underwritingRecallVisitor->argc['OrgCode'] = '51080503';

        $response = $IDock->underwritingRecall($shortName, $underwritingRecallVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer \IDock\Printer\UnderwritingRecallPrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer->toArray());
        exit;

    }

//电子保单下载
    if (0) {
        $EPolicyDownloadVisitor = new EPolicyDownloadVisitor();
        $EPolicyDownloadVisitor->policyNo = 'H060101080120230000059';
        $EPolicyDownloadVisitor->ciPolicyNo = 'H060101080120230000059';
        $EPolicyDownloadVisitor->biPolicyNo = 'H060101080820230000040';
        $EPolicyDownloadVisitor->argc['username'] = 'HBP0000067';
        $EPolicyDownloadVisitor->argc['password'] = 'Hbins@2022';
        $EPolicyDownloadVisitor->argc['type'] = 'ci';

        $response = $IDock->EPolicyDownload($shortName, $EPolicyDownloadVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());


        /**
         * @var $printer \IDock\Printer\EPolicyDownloadPrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer);
        exit;
    }

    if(0){
        $token = $IDock->getBean("HBIC")->getAuthorizationToken();
        var_dump($token);
    }

    if(0){
        $visitor = new NonCarProductListVisitor();
        $data = $IDock->getBean("HBIC")->nonCarProductList($visitor);
        var_dump($data);
    }

//保单详情
    if (0) {
        $policyInfoVisitor = new PolicyInfoVisitor();

        $policyInfoVisitor->policyNo = '299510803602023000033';

        $response = $IDock->policyInfo($shortName, $policyInfoVisitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());
        var_dump($response->getPrinter()->toArray());
        exit;
    }

} catch (Exception $e) {
    var_dump("异常抛出：" . $e->getFile() . " " . $e->getLine() . $e->getMessage());
}

